<?php

/**
 * Comercios form.
 *
 * @package    tercermilenio
 * @subpackage form
 * @author     Your name here
 */
class ComerciosForm extends BaseComerciosForm {

    public function configure() {

    }

    public function setup() {
        parent::setup();

        $this->setWidgets(array(
            'com_id' => new sfWidgetFormInputHidden(),
            'com_razon_social' => new sfWidgetFormInput(),
            'com_nombre' => new sfWidgetFormInput(),
            'com_cuit' => new sfWidgetFormInput(),
            'com_provincia' => new sfWidgetFormPropelChoice(array('model' => 'Provincias', 'add_empty' => 'Seleccione una provincia')),
            'com_localidad' => new sfWidgetFormPropelChoice(array('model' => 'Localidades', 'add_empty' => 'Seleccione una localidad')),
            'com_telefono1' => new sfWidgetFormInput(),
            'com_telefono2' => new sfWidgetFormInput(),
            'com_fax' => new sfWidgetFormInput(),
            'com_sitio_web' => new sfWidgetFormInput(),
            'com_email' => new sfWidgetFormInput(),
            #'com_codigo_postal' => new sfWidgetFormInput(),
        ));

        $this->setValidators(array(
            'com_id' => new sfValidatorPropelChoice(array('model' => 'Comercios', 'column' => 'com_id', 'required' => false)),
            'com_razon_social' => new sfValidatorString(array('max_length' => 100, 'required' => true)),
            'com_nombre' => new sfValidatorString(array('max_length' => 100, 'required' => true)),
            'com_cuit' => new sfValidatorString(array('max_length' => 30, 'required' => true)),
            'com_provincia' => new sfValidatorPropelChoice(array('model' => 'Provincias', 'column' => 'pcia_id', 'required' => false)),
            'com_localidad' => new sfValidatorPropelChoice(array('model' => 'Localidades', 'column' => 'loc_id', 'required' => false)),
            'com_telefono1' => new sfValidatorString(array('max_length' => 20, 'required' => false)),
            'com_telefono2' => new sfValidatorString(array('max_length' => 20, 'required' => false)),
            'com_fax' => new sfValidatorString(array('max_length' => 20, 'required' => false)),
            'com_sitio_web' => new sfValidatorString(array('max_length' => 100, 'required' => false)),
            'com_email' => new sfValidatorEmail(array('max_length' => 100, 'required' => false)),
            #'com_codigo_postal' => new sfValidatorInteger(array('required' => true)),
        ));

        $this->widgetSchema->setNameFormat('comercios[%s]');

        $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
    }

}
